//判断账号密码是否正确
$('#login').on('click',function(){
   const name = $('#name').val(),
         pwd = $('#pwd').val()
   $.post('../api/user/login.php',{name,pwd},resp=>{
      // console.log(resp)
      if(resp.code === 200){
         if($("#checkOne").is(':checked')){
            utils.setCookie('username',name,{path:'/',expires:7})
            }else{
            utils.setCookie('username',name,{path:'/'})
            }
         alert(resp.body.msg)
         location.href = '../index.html'
      }else if(resp.code === 201){
         alert('账号或者密码出错')
         $('#name').val('')
         $('#pwd').val('')
      }
   },'json')
})

